<?php
/**
 * Parameters
 * @param OrganizationalUnitForm 	$form 
 * @param array						$form_errors [optional]
 */
  use_stylesheets_for_form($form);
  use_javascripts_for_form($form); 
  if(!isset($form_errors)) $form_errors = array();
?>

		<form action="<?php echo url_for('organizational_unit_'.($form->getObject()->isNew() ? 'create' : 'update'), $form->getObject()) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?> id="organizational_unit_form">
          <?php if (!$form->getObject()->isNew()): ?>
          <input type="hidden" name="sf_method" value="put" />
          <?php endif; ?>
            <?php echo $form->renderHiddenFields(); ?>
            <?php echo $form->renderGlobalErrors(); ?>
            
			<div class="x8">
				
				<?php if(count($form_errors) > 0):?>
					<?php include_partial('global/form_error_list', array('form_errors' => $form_errors));?>
				<?php endif;?>
				
				<div class="tab_container">
					<ul class="tabs">
						<li><a href="#unit_master_data">Stammdaten</a></li>
						<li><a href="#unit_elective_offices">Wahlämter</a></li>
					</ul>
					
					<div class="tab_content_container">
						
						<div id="unit_master_data" class="tab_content">
							<div class="field">
								<?php echo $form['name']->renderLabel();?>
								<?php echo $form['name']->render();?>
							</div>
							<div class="field">
								<?php echo $form['organizational_entity_id']->renderLabel();?>
								<?php echo $form['organizational_entity_id']->render();?>
							</div>
							<div class="field">
								<?php echo $form['parent_id']->renderLabel();?>
								<?php echo $form['parent_id']->render();?>
							</div>
						</div>
						
						<div id="unit_elective_offices" class="tab_content">
							<?php $sub_form = $form->getElectiveOfficesForm();?>
							<?php foreach($sub_form as $widget):?>
							<?php if($widget->isHidden()) continue;?>
							<div class="field">
								<?php echo $widget->renderLabel();?>
								<?php echo $widget->render();?>
							</div>
							<?php endforeach;?>
						</div>
						
					</div>
					
				</div>
				
			</div>
			<div class="x4">
				<h2 class="box">Werkzeugbox<img alt="Werkzeugbox" src="<?php echo image_path('icons/content_werkzeugbox.png');?>" /></h2>
				<table class="box_table subnavigation">
					<tbody>
						<tr>
							<td><a href="#" onClick="document.forms['organizational_unit_form'].submit();return false;"><img alt="&Auml;nderungen speichern" src="<?php echo image_path('icons/content_subnavigation_bearbeiten.png');?>" />&Auml;nderungen speichern</a></td>
						</tr>
						<tr>
							<td><a href="<?php echo url_for('my_members');?>"><img alt="Abbrechen" src="<?php echo image_path('icons/content_loeschen.png');?>" />Abbrechen</a></td>
						</tr>
					</tbody>
				</table>
			</div>
		</form>
